package com.smart.business.dao;

import com.smart.entity.business.ParamEntity;
import com.smart.entity.business.ParameterTemplateEntity;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface ParamDao {
    @Select("SELECT id, name,code,unit,data_type FROM parameter_definition WHERE template_id=#{templateId} AND is_deleted = '0'")
    List<ParamEntity> templateParam(@Param("templateId") String templateId);

    @Update("UPDATE parameter_definition SET is_deleted = '1' WHERE id = #{id}")
    boolean delete(@Param("id") String id);
    @Insert("INSERT INTO parameter_definition (name,code,unit,template_id) VALUES (#{name},#{code},#{unit},#{templateId})")
    boolean insert(ParamEntity paramEntity);
    @Select("select id,name,description from parameter_template where parameter_template.meter_type_id = #{meterTypeId} and is_deleted = '0'")
    List<ParameterTemplateEntity> templateListByMeterTypeId(String meterTypeId);

    @Select("select name,code,unit,data_type from parameter_definition where id = #{parameterDefinitionId} and is_deleted = '0'")
    ParamEntity selectById(String parameterDefinitionId);
}
